package com.xh.audit.vo.webform;

import com.mybatisflex.core.query.QueryWrapper;
import com.xh.audit.entity.unituser.AuditUsers;
import lombok.Data;
import lombok.EqualsAndHashCode;

import static com.xh.audit.entity.unituser.table.AuditUsersTableDef.AUDIT_USERS;

@Data
@EqualsAndHashCode(callSuper = true)
public class AuditUsersQuery extends PageParams<AuditUsers> {
    private Integer affiliatedUnit;
    private String name;
    private String outsidersFlag;

    public QueryWrapper queryWrapperBuild() {
        QueryWrapper queryWrapper = QueryWrapper.create()
                .and(AUDIT_USERS.AFFILIATED_UNIT.eq(affiliatedUnit))
                .and(AUDIT_USERS.OUTSIDERS_FLAG.eq(outsidersFlag))
                .and(AUDIT_USERS.NAME.likeLeft(name));
        return queryWrapper;
    }
}
